const Port = process.env.PORT || 3022;
const nodeEnv = process.env.NODE_ENV;
const appPrefix = 'pitem';
const host = 'h5.panli.com';
const hostStatic = 's2.panli.com';
const hostStaticCommon =
  nodeEnv == 'production'
    ? `http://${hostStatic}`
    : `http://192.168.0.196:3017`;

const envHost = {
  test: {
    baseAPI: 'http://www.panli.com',
  },
  production: {
    baseAPI: 'http://www.panli.com',
  },
};

let BaseAPI =
  nodeEnv == 'production' ? envHost.production.baseAPI : envHost.test.baseAPI;

let STATIC_PATH = process.env.STATIC_PATH;

if (!STATIC_PATH) {
  STATIC_PATH =
    nodeEnv == 'production' ? `//` + hostStatic + `/${appPrefix}` : '';
}

// `//${hostStatic}/${appPrefix}` : ""
// STATIC_PATH = nodeEnv == "production";

let appLinkPrefix = nodeEnv != 'production' ? '' : `/${appPrefix}`;

let data = {
  port: Port,
  env: nodeEnv,
  useSentry: nodeEnv == 'production',
  appPrefix,
  host,
  BaseAPI,
  STATIC_PATH,
  appLinkPrefix,
  hostStaticCommon,
};

console.log('env:' + data.env);

module.exports = data;
